pair = "name = Aana"
-- () 捕获值
key,value = string.match(pair,"(%a+)%s*=%s*(%a+)")
print(key,value)
date = os.date()
print(date)
m,d,y = string.match(tostring(date),"(%w+)/(%w+)/(%w+)")
print(m,d,y)
s = [[tehn he said:"it's all right"!]]
-- [ab]表示其中一个即可 a | b
q,quotedPart = string.match(s,"([\"'])(.-)%1")
print(q,quotedPart)
-- "%0"意味着整个匹配
print(string.gsub("hello lua!","%a","%0-%0"))
print(string.gsub("hello lua","(.)(.)","%2%1"));
str = [[the \quote{task} is to \em{change} that.]]
str = string.gsub(str,"\\(%a+){(.-)}","<%1>%2<%1>")
print(str)